import request from '@/utils/request'
/** 获取管理后台管理菜单列表 */
export function GetMenuList() {
  return request({
    url: '/api/menu/list',
    method: 'get'
  });
}
// 获取系统应用列表
export function GetMenuApplication() {
  return request({
    url: '/api/app/list',
    method: 'get'
  })
}

export function GetParentMenuByApplication(data) {
  return request({
    url: '/api/menu/tree',
    method: 'get',
    params: data
  })
}

//  获取用户列表
export function GetUserList(data) {
  return request({
    url: '/api/user/page',
    method: 'get',
    params: data
  })
}

export function UserGetList(data) {
  return request({
    url: '/api/user/get',
    method: 'get',
    params: data
  })
}
export function GetPosList(data) {
  return request({
    url: '/api/pos/list',
    method: 'get',
    params: data
  })
}
export function GetRoleList(data) {
  return request({
    url: '/api/role/page',
    method: 'get',
    params: data
  })
}

export function setRole(data) {
  return request({
    headers: {
      'Content-Type': 'application/json'
    },
    url: '/api/role/set',
    method: 'post',
    data: data
  });
}

export function GetGrantTree(data) {
  return request({
    url: '/api/menu/grant-tree',
    method: 'get',
    params: data
  })
}

export function GetRoleMenu(data) {
  return request({
    url: '/api/role/role-menu',
    method: 'get',
    params: data
  })
}

export function MenuSet(data) {
  return request({
    headers: {
      'Content-Type': 'application/json'
    },
    url: '/api/menu/set',
    method: 'POST',
    data: data
  })
}

export function DelMenu(data) {
  return request({
    headers: {
      'Content-Type': 'application/json'
    },
    url: '/api/menu/del',
    method: 'POST',
    params: data
  })
}

//为角色授权菜单按钮
export function SetGrantMenu(data) {
  return request({
    headers: {
      'Content-Type': 'application/json'
    },
    url: '/api/role/set-grant-menu',
    method: 'POST',
    data: data
  })
}

export function DelRole(data) {
  return request({
    headers: {
      'Content-Type': 'application/json'
    },
    url: '/api/role/del',
    method: 'POST',
    params: data
  })
}

export function GetRoleUser(data) {
  return request({
    url: '/api/user/get-role',
    method: 'get',
    params: data
  })
}

export function SetRoleUser(data) {
  return request({
    headers: {
      'Content-Type': 'application/json'
    },
    url: '/api/user/set-role',
    method: 'POST',
    data: data
  })
}

export function DelUser(data) {
  return request({
    headers: {
      'Content-Type': 'application/json'
    },
    url: '/api/user/del',
    method: 'POST',
    params: data
  })
}

export function GetDepTree() {
  return request({
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    url: '/api/org/tree',
    method: 'get'
  })
}
export function GetDepList(data) {
  return request({
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    url: '/api/org/page',
    method: 'get',
    params: data
  })
}

export function UploadFile(file) {
  const data = new FormData()
  data.append('file', file)
  return request({
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    url: '/api/material/upload',
    method: 'post',
    data: data
  })
}

export function SetUser(data) {
  return request({
    headers: {
      'Content-Type': 'application/json'
    },
    url: '/api/user/set',
    method: 'POST',
    data: data
  })
}

export function AccountVerify(data) {
  return request({
    url: '/api/user/account-verify',
    method: 'post',
    params: data
  })
}
export function SetOrg(data) {
  return request({
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    url: '/api/org/set',
    method: 'post',
    data: data
  })
}

export function SetPassword(data) {
  return request({
    headers: {
      'Content-Type': 'application/json'
    },
    url: '/api/user/set-password',
    method: 'POST',
    data: data
  })
}

export function delOrg(data) {
  return request({
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    url: '/api/org/del',
    method: 'post',
    params: data
  })
}

